Fix memory leak in domain cleanup spotted by doremifa in #xen.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 2 Nov 2005 10:24:49 +0000 (11:24 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 2 Nov 2005 10:24:49 +0000 (11:24 +0100)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
tools/console/daemon/io.c

index ef3f094d27099058cc31f64d855bb6bd892245af..d4593f0d80154e9ac275517d593a6281912ed615 100644 (file)
@@ -380,12 +380,21 @@ static void cleanup_domain(struct domain *d)
        if (!buffer_empty(&d->buffer))
                return;
 
-       if (d->buffer.data)
+       if (d->buffer.data) {
                free(d->buffer.data);
-       d->buffer.data = NULL;
-       if (d->tty_fd != -1)
+               d->buffer.data = NULL;
+       }
+
+       if (d->tty_fd != -1) {
                close(d->tty_fd);
-       d->tty_fd = -1;
+               d->tty_fd = -1;
+       }
+
+       if (d->conspath) {
+               free(d->conspath);
+               d->conspath = NULL;
+       }
+
        remove_domain(d);
 }